#pragma once
#include "BaseRebot.h"
#include "Iocp.h"

class NetManagerRebot:public Rebot, public CSingleton<NetManagerRebot>
{
public:

	~NetManagerRebot(void);
protected:
	NetManagerRebot();
public:
	virtual void Load();
	virtual void Updata();
	virtual void PrintInfo();

	virtual unsigned int ProcFun();

	virtual unsigned int Init();
	virtual int OnInsideRead(InsideMsg* pMsg);
	DATA_ACCESS_ALLOW(NetManagerRebot);
public:
	Rebot*			CreateNetServiceRebot();
	LPPLEDATA		CreateNetHandleData();
	LPIOData		CreateIODataRobot();

	bool			ReleaseNetServiceRebot(Rebot* pRobot);
	bool			ReleaseNetHandleData(LPPLEDATA lpHandleData);
	bool			ReleaseIODataRobot(LPIOData lpIOData);
	bool            ReleaseClientRebot(Rebot* pRobot);
	void   DestroyRobot(Rebot* pRobot);

	void   Close();

	bool			ClientJoinIOCP(ClientRobot* pRobot);
private:
	std::string  NMA_IP;
	std::string  NCONFIG_IP;
	std::string  TAS_HTTPService_PORT;
	std::string  TAS_SIPService_PORT;


	Rebot* CreateServerRebot(string&  strClassName, string& ip, int port, string& photoType);
	
	CLock				  mapLock;	
	map<string, Rebot*>   mRegistServerRebotMap;

};

